package com.example.leetcode.linkedlist;

/*
// Definition for a Node.
class Node {
    int val;
    Node next;
    Node random;

    public Node(int val) {
        this.val = val;
        this.next = null;
        this.random = null;
    }
}
*/

import com.example.leetcode.linkedlist.common.LinkedListUtils;
import com.example.leetcode.linkedlist.common.Node;

import java.util.List;

class Solution138 {
    public Node copyRandomList(Node head) {
        return LinkedListUtils.copyRandomList(head);
    }
}

public class leetcode138 {
    public static void main(String[] args) {
        Solution138 solution138 = new Solution138();
        Integer[][] nums = {{7,null},{13,0},{11,4},{10,2},{1,0}};
        test138(solution138, nums);
    }

    private static void test138(Solution138 solution138, Integer[][] nums) {
        Node head = LinkedListUtils.generateLinkedListByArray(nums);
        List<List<Integer>> vals = LinkedListUtils.getLinkedListVals(solution138.copyRandomList(head));
        System.out.println(vals);
    }
}
